const Koa = require('koa');
const app = new Koa();

// 比如写一个计算请求耗时的中间件
app.use(async (ctx, next) => {
  console.time();
  next();
  console.timeEnd()
})

const one = (ctx, next) => {
  console.log('>> one');
  next();
  console.log('<< one');
  ctx.body = "response one"
}

const two = (ctx, next) => {
  console.log('>> two');
  next(); 
  console.log('<< two');
}

const three = (ctx, next) => {
  console.log('>> three');
  next();
  console.log('<< three');
}

app.use(one);
app.use(two);
app.use(three);

app.listen(9000);